package black.market.main;

import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.util.Log;
import android.widget.Toast;

public class BlackPublic {
	public static final int LOGLEVEL = 1;
	public static final String LOGTAG = "BlackPublic";

	public static void debugLog(String tag, String msg) {
		if (LOGLEVEL == 1) {
			Log.d(tag, msg);
		}
	}

	public static void errorLog(String tag, String msg) {
		if (LOGLEVEL == 1 || LOGLEVEL == 3) {
			Log.e(tag, msg);
		}
	}

	public static void identifiesLog(String tag, String msg) {
		if (LOGLEVEL == 1 || LOGLEVEL == 3) {
			Log.i(tag, msg);
		}
	}

	public static void warningLog(String tag, String msg) {
		if (LOGLEVEL == 1 || LOGLEVEL == 3) {
			Log.w(tag, msg);
		}
	}

	public static void shortToastMsg(Context context, String msg) {
		Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
	}

	public static void longToastMsg(Context context, String msg) {
		Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
	}

	public static boolean checkCursor(Cursor c) {
		return c.getCount() != 0 && c.moveToFirst();
	}

	public enum Action {
		GEOCODE_TO_ADDRESS, LOCATION_CHANGED_ACTION, START_READ_LOCATION_ACTION, STOP_READ_LOCATION_ACTION, KMA_DATA_INTERVAL3H, REMOTE_KMA_DATA_INTERVAL3H, GET_KMA_DATAREADLOCATION_15M, REMOTE_READLOCATION_1H, READLOCATION_1H, GET_KMA_DATA, SHARED_PREF;
		public static Action toAction(String str) {
			return valueOf(str.toUpperCase());
		}

		public static Action toAction(Intent intent) {
			return valueOf(intent.getAction().toUpperCase());
		}
	}
}
